<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var num;       //定义一个变量，没有赋值，则为undefined
        console.log(num);

        /**
         * 出现null的情况
         * 1.直接把变量定义位null
         * 2.获取页面中不存在的节点，返回null
        */

        var num = null
        console.log(null);

        let button = document.querySelector("button")
        console.log(button);
        botton.onclick = function() {
            
        }
        console.log(null);
        console.log(typeof([]));

        /**
         * instanceof:
         * 不能检测简单数据类型
         * 只能检测复杂数据类型
        */
       
        console.log("数字", 100 instanceof (Number));
        console.log("字符串","北京" instanceof(string));
        console.log("布尔",true instanceof(Boolean));

        console.log("数组",[] instanceof(Array));
        console.log("对象",{} instanceof(object));
        console.log("函数",function(){} instanceof(Function));

        /**
         * tostring
        */
       console.log("数字",object.prototype.toString.call(1));
       console.log("字符串",object.prototype.toString.call(""));
       console.log("布尔",object.prototype.toString.call(true));

       console.log("对象",object.prototype.toString.call({}));
       console.log("数组",object.prototype.toString.call([]));
       console.log("函数",object.prototype.toString.call(function(){}));

       console.log("数字",(10).constructor == Number);
       console.log("字符串",("你好").constructor == string);
       console.log("布尔",(true).constructor == Boolean);
       console.log("对象",({}).constructor == object);
       console.log("数组",([]).constructor == Array);
       console.log("函数",(function(){}).constructor == Function);
    </script>
</body>
</html>